package task8;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;

public class HashSetTest {
    public static void main(String[] args) {
        HashSet<Student> studentHashSet=new HashSet<Student>();
        Student s1=new Student("rose",18);
        Student s2=new Student("rose",18);
        Student s3=new Student("rose",20);
        studentHashSet.add(s1);
        studentHashSet.add(s2);
        studentHashSet.add(s3);
        Iterator iterator=studentHashSet.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }













/**
        HashSet<String> stringHashSet=new HashSet<String>();
        stringHashSet.add("zhangsan");
        stringHashSet.add("lisi");
        stringHashSet.add("wangwu");
        stringHashSet.add("wangwu");

        for (String s:stringHashSet){
            System.out.println(s);
        }
        Iterator iterator=stringHashSet.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }*/
    }
}
